package database;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
/**
 * This class is never used, but it shows the database schema design, if I had more time to implement this 
 * it would've stored annotation data. 
 * @author lawlerr1
 *
 */
public class DatabaseHelper extends SQLiteOpenHelper {
	static final String dbName="kmGraphDB";
	static final String tableName="DataPoints";
	static final String colMonth="MonthSurvival";
	static final String colPerc="PercentageSurvived";
	static final String colAnon="Annotation";
	static final String colSet="DateSet";
	
	static final String sourceTable = "Sources";
	static final String sourceName = "Name";
	static final String sourceURL = "URL";
	
	public DatabaseHelper(Context context) {
		super(context, dbName, null, 33);
	}

	@Override
	public void onCreate(SQLiteDatabase db) {
		db.execSQL("CREATE TABLE "+ tableName +" ("+colMonth+ " INTEGER PRIMARY KEY , "+
			    colPerc+ " INT, "+ colAnon+ " TEXT )");			  
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		db.execSQL("DROP TABLE IF EXISTS " + tableName);		
	}
	
	public void addPoint (SQLiteDatabase db, int months, int percent){
		db.execSQL("INSERT INTO "+tableName+" ("+ colMonth+", "+colPerc+")"+"VALUES (" +months+", "+percent+");");
	}
	public void addAnnotatedPoint (SQLiteDatabase db, int months, int percent, String annotation){
		
	}
	public void addAnnotation (SQLiteDatabase db, int months, String annotation){
		
	}
}
